package com.ijolas.test;

import java.awt.Image;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;

import javax.imageio.ImageIO;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;

public class ImageDownloader {
	
	private static final String url = "http://ns223506.ovh.net/rozne/83f632e8a2fbfd894f7164a88de3d2f2/wallpaper-2486614.jpg";
	
	public static void downloadImage() {
		Image image = null;
		try {
		    URL url = new URL("http://www.yahoo.com/image_to_read.jpg");
		    image = ImageIO.read(url);
		    FileOutputStream fos = new FileOutputStream("/Users/kazunoriimamura/Desktop/ijolas.jpg");
		    
		    
		    //fos.write(image);
		    fos.close();
		    
		    Document doc = Jsoup.connect("http://en.wikipedia.org/").get();
		    Elements newsHeadlines = doc.select("#mp-itn b a");
		    
		} // try
		catch (IOException e) {
			e.printStackTrace();
		} // catch
	}

}
